﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SpatialHashing
{
    class SpatialCell<T>
    {
        private Vector3 start;
        private Vector3 stop;
        private Vector3 center;
        private LinkedList<T> items;

        public SpatialCell(Vector3 center, float cellSize)
        {
            this.center = center;

            float delta = 0.5f * cellSize;
            this.start = new Vector3(center.x - delta, center.y - delta, center.z - delta);
            this.stop = new Vector3(center.x + delta, center.y + delta, center.z + delta);

            items = new LinkedList<T>();
        }

        public Vector3 getStart()
        {
            return start;
        }
        public Vector3 getStop()
        {
            return stop;
        }
        public Vector3 getCenter()
        {
            return center;
        }

        public void addItem(T item)
        {
            items.AddLast(item);
        }
        public LinkedList<T> getItemsRef()
        {
            return items;
        }
    }
}
